#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int INF = 2147483647;
/*
曼哈顿距离 |a - x| + |b - y| = max(a - x + b - y, - (a - x) + b - y, (a - x) - (b - y), -(a - x) - (b - y))
*/

int n, m;
int mx[5];


void solve() {
    cin >> n >> m;
    string s;
    mx[1] = mx[2] = mx[3] = mx[4] = -INF;
    for (int i = 1; i <= n; i++) {
        cin >> s;
        for (int j = 1; j <= m; j++) {
            
            if (s[j - 1] == 'B') {
                mx[1] = max(mx[1], i + j);
                mx[2] = max(mx[2], i - j);
                mx[3] = max(mx[3], -i + j);
                mx[4] = max(mx[4], -i - j);
            }     
    }
    }
    int ans = INF;
    int ans_i, ans_j;
    for (int i = 1; i <= n; i++)for (int j = 1; j <= m; j++) {
        int res = max({
            mx[1] - i - j,
            mx[2] - i + j,
            mx[3] + i - j,
            mx[4] + i + j
            });
        if (res < ans) {
            ans = res;
            ans_i = i, ans_j = j;
        }
    }
    cout << ans_i << " " << ans_j << endl;
}



int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;
    while(T--){
        solve();
    }


    return 0;
}